#ifndef __CAMERA_H__
#define __CAMERA_H__

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>

#define V4L2_BUF_CNT 4

struct V4l2FmtDesc {
    __u8                description[32];    /* Description string */
    __u32               pixelformat;        /* Format fourcc      */
    __u32               width;
    __u32               height;
    __u32               sizeimage;
    struct v4l2_fract   fract;
};

struct MemoryList {
    void *              virtAddr;
    void *              saveImageAddr;
    size_t              length;
    size_t              imgSize;
};

struct V4l2MemDesc {
    enum v4l2_memory    memoryType;
    struct MemoryList * memoryList;
    __u32               memCount;
};

struct DeviceFormat {
    struct V4l2FmtDesc  fmtDesc;
    struct V4l2MemDesc  memDesc;
    enum v4l2_buf_type  bufType;

};

typedef void (*CallBack)(int index, struct MemoryList *memory);

#endif /* end of __CAMERA_H__ */
